#include<iostream>
#include<Eigen/Dense>

using namespace Eigen;
using namespace std;

int main(int argc,char **argv){

    Vector3d v(1,2,3);
    Vector3d w(0,1,2);

    cout << "Dot product: " << v.dot(w) << endl;

    double dp = v.adjoint() * w;

    cout << "Dot product via a matrix product: " << dp << endl;

    cout << "Cross product:\n" << v.cross(w) << endl;


    Matrix2d mat;
    mat << 1,2,3,4;

    cout << "Here is mat.sum(): " << mat.sum() << endl;
    cout << "Here is mat.prod(): " << mat.prod() << endl;
    cout << "Here is mat.mean(): " << mat.mean() << endl;
    cout << "Here is mat.minCoeff(): " << mat.minCoeff() << endl;
    cout << "Here is mat.maxCoeff(): " << mat.maxCoeff() << endl;
    cout << "Here is mat.trace(): " << mat.trace() << endl;

    Matrix3f m = Matrix3f::Random();
    std::ptrdiff_t i,j;
    float minofM = m.minCoeff(&i,&j);
    cout << "Here is the matrix m:\n" << m << endl;
    cout << "Its minimum coefficient (" << minofM << ") is at position ("
    << i <<"," << j <<")\n\n";

    RowVector4i v2 = RowVector4i::Random();
    int maxofV = v2.maxCoeff(&i);
    cout <<"Here is the vector v2: " << v2 << endl;
    cout <<"Its maximum coefficient (" << maxofV
         <<") is at position " << i << endl;

    return 0;
}
